export interface FormConfigType {
  labelWidth: string;
  size?: number | string;
}

export interface SaverConfigType {
  title: string;
  width: string | number;
  appendToBody?: boolean;
  submitMethod?(formData: { [key: string]: any }, $dialog?: any): void; // 提交回调事件
}

export interface BaseFormItem {
  name: string;
  prop: string;
  label: string;
  defaultValue: string | Array<any> | number | boolean | object;
  disabled?: boolean;
  noEdit?: boolean;

  type?: string; // 输入框时使用
  span?: number; // 只有在search里面需要填，不然不生效
  placeholder?: string;
  rules?: Array<any>;
  style?: string | object;
  corrProp?: string;
}

export type InputItem = BaseFormItem;

export interface OptionType {
  label: string;
  value: number | boolean | string;
}

export interface SelectItem extends BaseFormItem {
  options(): OptionType[];
}

export interface AsyncSelectItem extends BaseFormItem {
  url: string;
  formatter?(arr: any[]): OptionType[];
}

export interface SelectCorrItem extends BaseFormItem {
  options(val: string | number | boolean): OptionType[];
}

export interface DataRangeItem extends BaseFormItem {
  startPlaceholder: string;
  endPlaceholder: string;
  rangeSeparator: string;
}
